Skip to content

Conversation

@moisespsena
Copy link

Added support for basic authentication with custom script.

Generate linux system authentication script from template (see content below):

gotty --sys-auth-tpl > ./auth.sh
chmod +x ./auth.sh

NOTE: this script requires root access (or sudo).

Usage example:

sudo gotty --authenticator ./auth.sh top

Access web page and login with your linux username and password.

Content of ./auth.sh:

#!/bin/bash

# #### REQUEST INFO ####
# echo REQUEST INFO:
# json_pp

username="$1"
password="$2"

salt=$(getent shadow $username | cut -d$ -f3)
epassword=$(getent shadow $username | cut -d: -f2)

match=$(python -c 'import crypt; print crypt.crypt("'"$password"'", "$6$'$salt'")')

if [ "$match" == "$epassword" ]; then
  # success
  exit 0
fi

# failed
exit 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants